<template>
  <view class="body">
    <view class="top_info">
      <image class="color_img" src="https://ainengli.hzjrsw.com/jkhx/answerBg.png"></image>
      <view class="title">风险自测筛查结果</view>
      <view class="label">
        <image class="label_img" src="@/static/image/raozg/shield.png" />
        <text>认知障碍自评表AD8</text>
      </view>
    </view>
    <view v-if="score > 1" class="question_body">
      <image class="risk_img" src="https://ainengli.hzjrsw.com/jkhx/risk.png" />
      <view class="risk_text" style="color: #ff503d">存在风险</view>
      <view class="text_bottom">需要临床医师进一步检查评估</view>
    </view>
    <view v-else class="question_body">
      <image class="risk_img" src="https://ainengli.hzjrsw.com/jkhx/norisk.png" />
      <view class="risk_text" style="color: #00d1b6">暂无风险</view>
      <view class="text_bottom">不排除非常早期的疾病</view>
    </view>
    <view class="fixed">
      <button class="confirm_btn" @tap="restart">重新评估</button>
    </view>
  </view>
</template>

<script setup lang="ts">
import { onLoad, onShow } from '@dcloudio/uni-app'
import { scale_list, scale_save } from '@/api/body'
import { ref, reactive } from 'vue'

const score = ref(0)
const title = ref('')

onLoad((option) => {
  score.value = option.score ? option.score : 0
  title.value = option.title ? option.title : ''
})

const restart = () => {
  uni.redirectTo({ url: '/packA/pages/body/questionnaire' })
}
</script>

<style lang="scss" scoped>
.body {
  width: 100%;
  height: 100vh;
  overflow: auto;
  padding-bottom: 184rpx;
  box-sizing: border-box;
  position: relative;
  .top_info {
    height: 512rpx;
    background: linear-gradient(180deg, rgba(172, 235, 242, 0.28) 0%, #f3f7f8 100%);
    padding: 48rpx 32rpx;
    position: relative;
    .color_img {
      position: absolute;
      left: 0;
      top: 0;
      z-index: 1;
      width: 100%;
      height: 328rpx;
    }
    .title {
      font-weight: 600;
      font-size: 48rpx;
      color: #222222;
      margin-bottom: 16rpx;
      position: relative;
      z-index: 2;
    }
    .label {
      display: inline-block;
      background: #00d1b6;
      border-radius: 28rpx;
      border: 1rpx solid #00d1b6;
      font-weight: 400;
      font-size: 26rpx;
      color: #ffffff;
      padding: 10rpx 32rpx;
      position: relative;
      z-index: 2;
      .label_img {
        width: 28rpx;
        height: 28rpx;
        margin-right: 8rpx;
        transform: translateY(4rpx);
      }
    }
  }
  .question_body {
    background: #fff;
    border-radius: 16rpx;
    padding: 32rpx;
    padding-bottom: 120rpx;
    margin: 0 32rpx;
    margin-top: -256rpx;
    font-size: 28rpx;
    position: relative;
    text-align: center;
    z-index: 2;
    .risk_img {
      width: 208rpx;
      height: 208rpx;
      margin-top: 120rpx;
    }
    .risk_text {
      font-weight: 600;
      font-size: 48rpx;
      margin-top: 48rpx;
    }
    .text_bottom {
      font-weight: 400;
      font-size: 32rpx;
      color: #222222;
      margin-top: 24rpx;
    }
  }
  .fixed {
    position: fixed;
    width: 100%;
    bottom: 0;
    left: 0;
    z-index: 10;
    padding: 24rpx 32rpx;
    padding-bottom: calc(24rpx + constant(safe-area-inset-bottom));
    padding-bottom: calc(24rpx + env(safe-area-inset-bottom));
    box-sizing: border-box;
    background: #ffffff;
    .confirm_btn {
      width: 100%;
      background: #00d1b6;
      border-radius: 44rpx;
      font-weight: 500;
      font-size: 32rpx;
      color: #ffffff;
    }
  }
}
</style>
